import loadPlugin from '../../app/config/loadplugin.config.js';
import authService from '../../app/resolves/authService.js';
import getCpList from '../resolves/getCpList.js';
import getCpDetail from '../resolves/getCpDetail.js';

import equipmentaddHtml from 'ngtemplate!html!../../../tpls/equipment/equipment.add.html';
import equipmentEditHtml from 'ngtemplate!html!../../../tpls/equipment/equipment.edit.html';
import equipmentListHtml from 'ngtemplate!html!../../../tpls/equipment/equipment.list.html';

/**
 * EquipmentRouter - config
 * 赛事模块路由设置
 */
EquipmentRouter.$inject = ['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', '$ocLazyLoadProvider'];
function EquipmentRouter($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider, $ocLazyLoadProvider) {

	//set router
    $stateProvider

		// 新建设备
		.state('dashboard.race.equipmentadd', {
		    url: '/equipment/add',
		    data: { 
		        pageTitle: '新建设备' 
		    },
		    templateUrl: equipmentaddHtml,
		    controller: 'EquipmentAddController as vm',
		    resolve: {
		    	authService: authService,
		    	getCpList: getCpList
		    }
		})

		// 编辑
		.state('dashboard.race.equipmentedit', {
		    url: '/equipment/edit?equipmentName&cpName',
		    data: { 
		        pageTitle: '设备绑定(编辑)' 
		    },
		    templateUrl: equipmentEditHtml,
		    controller: 'EquipmentEditController as vm',
		    resolve: {
		    	authService: authService,
		    	getCpList: getCpList
		    }
		})

		// 设备列表
		.state('dashboard.race.equipmentlist', {
		    url: '/equipment/list',
		    data: { 
		        pageTitle: '设备列表' 
		    },
		    templateUrl: equipmentListHtml,
		    controller: 'EquipmentListController as vm',
		    resolve: {
		    	authService: authService,
		    	getCpList: getCpList
		    }
		});

}

export default EquipmentRouter; 